package com.batchOperation.excel.executor;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @Package: com.batchOperation.Executor
 * @ClassName: ExecutorStrategy
 * @Author: wulongkai
 * @CreateTime: 2024/7/19 11:30
 * @Description: 策略模式，把所有实现了 IExecutor 的类都 put 到 executorMap
 */
@Component
public class ExecutorStrategy {

    @Autowired
    private final Map<String, IExecutor> executorMap = new ConcurrentHashMap<>();

    public IExecutor getExecutor(String mainObj) {
        return executorMap.get(mainObj);
    }
}
